import 'package:dailoz/service/homePage_service/homePage_service.dart';
import 'package:dailoz/service/tag_service/tag_service.dart';
import 'package:flutter/cupertino.dart';

class ProfilePageViewModel extends ChangeNotifier {
  List<dynamic>? _tagList = [];

  bool _isLoading = false;

  String? _userName = "";

  List<dynamic>? get tagList {
    return _tagList;
  }

  bool? get isLoading {
    return _isLoading;
  }

  String? get userName {
    return _userName;
  }

  Future<void> fetchUserName() async {
    try {
      _userName = await HomePageService.getName();
    } catch (e) {
      print(e);
    } finally {
      notifyListeners();
    }
  }

  Future<void> fetchTagList() async {
    _tagList!.clear();
    _isLoading = true;
    try {
      _tagList = await TagService.getTagList();
    } catch (e) {
      print(e);
    } finally {
      _isLoading = false;
      notifyListeners();
    }
  }
}
